<?php 
namespace Home\Model;
use Think\Model;
class VerifyModel extends Model {
	/*模型定义验证码表*/
	public function getOneVerify()
	{	/*随机获得一条验证码*/
		$sql = "select * from verify order by rand() limit 1";

		/*query()继承Model，*/
		$question = $this->query($sql);
		//var_dump($question);exit;

		//返回单前维数组
		$question = current($question);

		//把数据库的 答案存入session
		$_SESSION['answer'] = $question['answer'];

		//返回验证码题目
		return $question['question'];
	}

}



 ?>